<template>
  <div>
    <el-dialog
      :title="title"
      :visible.sync="value"
      width="800px"
      append-to-body
      custom-class="import-dialog"
      @close="close"
    >
      <el-table :data="tableData" style="width: 100%">
        <el-table-column prop="premisesAddress" label="房间"> </el-table-column>
        <el-table-column prop="expensesType" label="下单方式">
          <template slot-scope="scope">
            {{ scope.row.expensesType == 1 ? "下单" : "续租" }}
          </template>
        </el-table-column>
        <el-table-column prop="rentingTime" label="入住日期"> </el-table-column>
        <el-table-column prop="rentingExpenses" label="房费"> </el-table-column>
      </el-table>
    </el-dialog>
  </div>
</template>

<script>
import formRule from "@/utils/formRule.js";
import { expensesInfo } from "@/api/order/short";
export default {
  name: "signOrder",
  dicts: ["order_short_state", "order_source"],
  components: {},
  props: {
    title: {
      default: "订单信息",
    },
    value: {
      default: false,
    },
    orderId: {
      default: undefined,
    },
    isDetail: {
      default: false,
    },
    success: {
      type: Function,
      default: () => {},
    },
  },
  data() {
    return {
      unsubscribeContentMap: {},
      visible: false,
      dialogSelectHouseVisible: false,
      tableData: [],
      areaCalculateState: false,
      chargeItemList: [],
      chargeItemSelected: [],
      detailDialogVisible: false,
    };
  },
  computed: {},
  watch: {},
  mounted() {
    this.getInfo();
  },
  methods: {
    init() {
      //重置
      //this.reset();
    },
    //日期更改
    periodChange(e) {
      this.form.checkInTime = e[0] + " 00:00:00";
      this.form.checkOutTime = e[1] + " 23:59:00";
    },
    finallySignChange(e) {
      this.form.finallySignTime = e + " 23:59:00";
    },
    //重置表单
    reset() {
      this.form = this.$options.data().form;
    },

    formatLabel(value, arr) {
      let data = this[arr].find((item) => {
        return item.value == value;
      });
      return data.label;
    },
    //获取详情
    getInfo() {
      if (!this.orderId) return;
      expensesInfo(this.orderId).then((response) => {
        this.tableData = response.rows;
      });
    },
    //提交表单
    submitForm: function () {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.auditRecordState == 2) {
            delete this.form.remark;
          }
          checkAuditRecord(this.form).then((response) => {
            this.$emit("success");
            this.$message.success("审核成功");
            this.visible = false;
          });
        }
      });
    },
    //关闭
    close() {
      this.$emit("input", false);
    },
  },
};
</script>

<style lang="scss" scoped>
.import-dialog {
  height: auto;
  max-height: 80vh;
  overflow-y: auto;
  .dialog-footer {
    text-align: center;
  }
}
::v-deep .el-dialog__body {
  max-height: 80vh !important;
  overflow-y: auto;
}
.form-box {
  .tabs {
    display: flex;
    .tabs-item {
      padding: 0 10px;
      height: 40px;
      line-height: 40px;
      font-size: 16px;
      position: relative;
      cursor: pointer;
      &::before {
        content: "";
        position: absolute;
        left: 50%;
        bottom: -2px;
        width: 0;
        height: 2px;
        opacity: 0;
        background: #0caaf0;
        transition: all 0.3s;
      }
      &.active {
        color: #0caaf0;
        &::before {
          opacity: 1;
          left: 0;
          width: 100%;
        }
        cursor: default;
      }
    }
  }
  .add-form {
    .section {
      .label {
        display: flex;
        margin-bottom: 20px;
        font-size: 16px;
        align-items: center;
        color: #303133;
        label {
          display: block;
          width: 80px;
          &.dot::before {
            content: "*";
            color: #ff4949;
            margin-right: 4px;
          }
        }
        .icon {
          color: #02a7f0;
          font-size: 30px;
          margin-left: 30px;
          cursor: pointer;
        }
      }
      .tips {
        color: #aaaaaa;
      }
      .custom-formItem-lable {
        display: flex;
        align-items: center;
        .handle-icon {
          color: #02a7f0;
          font-size: 30px;
          margin-left: 30px;
          cursor: pointer;
        }
      }
      .handle-icon {
        color: #02a7f0;
        font-size: 30px;
        cursor: pointer;
      }
    }
  }
}
</style>
